package org.adoxx.pn.simulation.handlers.impl;

import java.util.ArrayList;
import java.util.HashMap;

import org.adoxx.pn.PetriNet;
import org.adoxx.pn.PetriNet.PL;
import org.adoxx.pn.PetriNet.TR;
import org.adoxx.pn.simulation.handlers.TransitionSelectorA;

public class TransitionSelectorDefault extends TransitionSelectorA{

    public TransitionSelectorDefault(PetriNet pn) {
        super(pn);
    }
    
    public TransitionSelectorDefault() {
        super();
    }

    @Override
    public TR chooseTransition(ArrayList<TR> transitionEnabledList) throws Exception {
        HashMap<PL, ArrayList<TR>> transitionEnabledGroupList = this.calculateRelatedSets(transitionEnabledList);
        TransitionGroupInfos transitionEnabledGroup = this.chooseTransitionEnabledGroup(transitionEnabledGroupList);
        TR transitionToFire = this.chooseTransitionToFire(transitionEnabledGroup);
        return transitionToFire;
    }

}
